﻿using System.Collections.Generic;
using System.Data.SqlClient;
using com.fukefu.sql;

namespace com.fukefu.tools
{
    public class IllegalWords
    {
        Dictionary<string, string> dic = new Dictionary<string, string>();

        public IllegalWords()
        {
            Init();
        }

        private void Init()
        {
            SqlServerOperate sql = new SqlServerOperate();
            SqlDataReader re = sql.Query("select * from [全局设置].dbo.[_mb_非法词]");
            while (re.Read())
            {
                dic.Add(re["word"].ToString(), re["tihuan"].ToString());
            }
            re.Close();
            sql.Close();
        }
        public string Execute(string html)
        {
            foreach (KeyValuePair<string, string> kvp in dic)
            {
                html = html.Replace(kvp.Key, kvp.Value);
            }
            return html;
        }
    }
}
